package com.spps;

import java.util.HashMap;

public class Commander {
    HashMap<String, String> options = new HashMap<>();

    Commander(String[] args, HashMap<String, String> optionMap) {

        if (args.length == 0) {
            throw new Error("Please enter the command options.");
        }

        options.put("action", args[0]);

        optionMap.forEach((key, value) -> {
            for (int i = 1; i < args.length; i++) {
                if (args[i].equals(key)) {
                    options.put(value, args[i + 1]);
                }
            }
        });
    }

    HashMap<String, String> gets() {
        return options;
    }

    String get(String key) {
        return options.get(key);
    }
}
